<%--
  Created by IntelliJ IDEA.
  User: Reimu
  Date: 2022/5/7
  Time: 19:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录</title>
</head>
<body>
<form action="index.jsp">
    用户名：<input type="text" name="userName" > <br>
    密码：<input type="password" name="passWord"> <br>
    <input type="submit" value="提交">
</form>

<%
    String userName = request.getParameter("userName");
    String passWord = request.getParameter("passWord");
    if (userName == null) {
        out.println("请输入用户名！");
    } else if (passWord == null) {
        out.println("请输入密码！");
    } else if (userName.equals("aaa") && passWord.equals("aaa")) {
        response.sendRedirect("hello.jsp");
    } else {
        out.println("登录失败！");
        response.sendRedirect("index.jsp");
    }
%>
</body>
</html>
